// miniprogram/group_admin/pages/orderContent/orderContent.js
// 获取api
const api = require("../../../utils/api.js")
Page({

  /**
   * 页面的初始数据
   */
  data: {
    orderguid:"",
    isFinishTime:"需付款",
    isFinish:false,
    "orderModule":""
  },

   //去付款
 goMoney:function(e){
    var that=this;
    wx.navigateTo({
      url: '/group_admin/pages/sureOrder/sureOrder?orderguid='+that.data.orderguid,
    })
 },

//  获取订单详情
 getOrderContent:function(){
  // 获取用户的sessionid uid
  var resYtkUserInfo= wx.getStorageSync("USERDATA");
  var params = {
    "sessionid": resYtkUserInfo.sessionid,
    "uid": resYtkUserInfo.uid,
    //  "sessionid": "ba82cc3a323e4f5da6e422c39b171d4c",
    //  "uid": "462D049EB2338AFA",
     "orderguid":this.data.orderguid,
     "market": getApp().globalData.market
  };
  // 根据orderguid获取订单详情
  var url = "/order/getOrderDetail";
  var that = this;
  api.sendPosts( url,params, function(res) {
    that.setData({
      "orderContentList": res,
      "memberSystemTitle":res.courselist[0].memberSystemTitle
      });
  });
},
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // 获取订单orderguid
    var orderguid=options.orderguid;
    var coursename=options.coursename;
    var finishtime=options.finishtime;
    var expirationtime=options.expirationtime;
    var orderModule=options.orderModule;
    console.log("----------------orderModule-------------------------"+orderModule);
    this.setData({
      "orderguid":orderguid,
      "coursename":coursename,
      "finishtime":finishtime,
      "expirationtime":expirationtime,
      "orderModule":orderModule,
    })
    var that=this;
    if(this.data.finishtime){
      that.setData({
        isFinishTime:"实付款",
        isFinish:true
      })
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

    // 获取订单详情
    this.getOrderContent();

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})